﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;

namespace Nivdal
{
    public partial class MatschSentencesTranslated : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = Resources.Resource.Default_PageTitle + ", " + Resources.Resource.MatschSentencesTranslated_PageTitle;
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                Response.Redirect("~/Default.aspx");
            else
            {
                OnlineUser ou = (OnlineUser)Session["User"]; 
                
                if ((ou.UserAccessLevel != ("5")) && (ou.UserAccessLevel != ("3")))
                {
                    Response.Redirect("~/GeneralMessage.aspx?MessageString=" + ou.UserAccessLevel);
                }
                
                if (ou.TeamId == "Null")
                    Response.Redirect("~/GeneralMessage.aspx?MessageString=274ggdizz5!lk");

                if (!IsPostBack)
                {
                    ShowStadiumsValuesSqlDataSource.SelectParameters.Add("UserId", ou.UserId);
                    SkippedMatchSentencesDatasource.SelectParameters.Add("UserId", ou.UserId);
                }
            }

        }

        protected void UnskipSentence(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Unskip")
            {
                GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
                GND.ExecNivdalSQL("IgnoreId", "Nivdal_UnIgnoreMatchSentenceTranslation", e.CommandArgument);
                SkippedSentencesGridView.DataBind();
            }
        }

        protected override void InitializeCulture()
        {
            OnlineUser ou = (OnlineUser)Session["User"];
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(ou.UICulture);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ou.Culture);
        }
    }
}